package com.phkj.qdh.repository

import com.phkj.qdh.bean.BaseInspectBean
import com.phkj.qdh.bean.DeptTreeVoList
import com.phkj.qdh.bean.Detail
import com.phkj.qdh.bean.KeyPointData
import com.phkj.qdh.bean.KeyPointDataBean
import com.phkj.qdh.bean.LawOrTeamInspectBean
import com.phkj.qdh.bean.TeamScoreBean
import com.phkj.qdh.net.BASE_INSPECT
import com.phkj.qdh.net.BASE_INSPECT_ADD
import com.phkj.qdh.net.BASE_KEY_IMPORT
import com.phkj.qdh.net.BASE_SCORE_LISt
import com.phkj.qdh.net.LAW_INSPECT_SAVE
import com.phkj.qdh.net.LAW_TEAM_INSPECT
import com.phkj.qdh.net.MEMBER
import com.phkj.qdh.net.PageList
import com.phkj.qdh.net.TEAM_INSPECT_SAVE
import com.phkj.qdh.net.TEAM_SCORE
import rxhttp3.RxHttp
import rxhttp3.toFlowResponse

object InspectRepository {
    //获取队伍或执法巡查分类
    fun lawAndTeamTree(parentId:Int) =
        RxHttp.get(LAW_TEAM_INSPECT).add("parentId",parentId).toFlowResponse<ArrayList<LawOrTeamInspectBean>>()

    fun getScoreList(type:Int) =
        RxHttp.get(TEAM_SCORE).add("scoreType",type).toFlowResponse<ArrayList<TeamScoreBean>>()
    fun getBaseScoreList(type:Int) =
        RxHttp.get(BASE_SCORE_LISt).add("scoreType",type).toFlowResponse<ArrayList<TeamScoreBean>>()

    fun saveLawInspect(map: HashMap<String, Any?>) =
        RxHttp.postJson(LAW_INSPECT_SAVE).addAll(map).toFlowResponse<Boolean>()

    fun saveTeamInspect(map: HashMap<String, Any?>) =
        RxHttp.postJson(TEAM_INSPECT_SAVE).addAll(map).toFlowResponse<Boolean>()

    fun getEmployee() =
        RxHttp.get(MEMBER).toFlowResponse<ArrayList<DeptTreeVoList>>()

    fun getBaseInspectType()=  RxHttp.get(BASE_INSPECT).toFlowResponse<ArrayList<BaseInspectBean>>()

    fun baseInspectSave(map:HashMap<String,Any?>) = RxHttp.postJson(BASE_INSPECT_ADD).addAll(map).toFlowResponse<String>()


    fun baseKeyPointType(map:HashMap<String,Any?>) = RxHttp.postJson(BASE_KEY_IMPORT).addAll(map).toFlowResponse<PageList<KeyPointData>>()

}